<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCommentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comment', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('goods_id')->comment('商品id');
            $table->integer('attr_id')->comment('商品属性id');
            $table->integer('user_id')->comment('用户id');
            $table->dateTime('comment_time')->comment('评论时间');
            $table->string('comment_content')->default('')->comment('评论内容');
            $table->tinyInteger('comment_score')->default(1)->comment('商品评分');
            $table->tinyInteger('comment_status')->default(1)->comment('评论状态1正常0隐藏');
            $table->index(['goods_id','attr_id']);
            $table->index('comment_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('comment');
    }
}
